package com.jasiri.project.adapter

import androidx.recyclerview.widget.RecyclerView
import com.jasiri.project.R
import com.jasiri.project.utils.gilde.ImageUtil
import com.jasiri.lib.baseadapter.JasiriRecyclerViewAdapter
import com.jasiri.lib.baseadapter.JasiriViewHolderHelper
import org.json.JSONObject

/**
 * Sikadwa
 * @Author wwdeng
 * @CreateTime: 2024/4/24 14:42
 * @Annotation：贷款审核推荐APP适配器
 */
class RecommendAppAdapter(recyclerView: RecyclerView?) : JasiriRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.item_recommended_app) {
    override fun setItemChildListener(helper: JasiriViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.installLayout) //点击安装
    }

    override fun fillData(helper: JasiriViewHolderHelper, position: Int, model: JSONObject) {
        helper.setText(R.id.textAppName,model.optString("appName","xxx"))
        helper.setText(R.id.textAmount,model.optString("appLoanAmount","0"))
        helper.setText(R.id.textScore,model.optString("star","0"))
        helper.setText(R.id.textCount,model.optString("download","0"))
        val imgLogo = helper.getImageView(R.id.imgLogo)
        ImageUtil.instance?.loadImageUrl(mContext,imgLogo,model.optString("appLogo"),R.mipmap.img_holder)
    }
}